home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Web Server / PHP.EXE / pear / PHPDoc / renderer / html / PhpdocHTMLRenderer.php < prev    next >
Encoding:
PHP Script  |  2001-02-18  |  1.7 KB  |  81 lines

  1. <?php
  2. /**
  3. * Default HTML Renderer based on templates.
  4. *
  5. * @version $Id: PhpdocHTMLRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $
  6. */
  7. class PhpdocHTMLRenderer extends PhpdocRendererObject {
  8.  
  9.     /**
  10.     * Template object
  11.     *
  12.     * @var  object  IntegratedTemplate
  13.     */    
  14.     var $tpl;
  15.  
  16.     /**
  17.     * XML data accessor object.
  18.     *
  19.     * @var  object  PhpdocAccessor
  20.     */
  21.     var $accessor;
  22.  
  23.     /**
  24.     * Rootpath for Templatefiles.
  25.     *
  26.     * @var  string  $templateRoot
  27.     * @see  setTemplateRoot()
  28.     */
  29.     var $templateRoot = "";
  30.  
  31.     /**
  32.     * Directory path prefix.
  33.     *
  34.     * @var  string  $path
  35.     */
  36.     var $path = "";
  37.  
  38.     /**
  39.     * Sets a directory path prefix.
  40.     *
  41.     * @param    string    
  42.     */
  43.     function setPath($path) {
  44.  
  45.         if (!empty($path) && "/" != substr($path, -1))
  46.             $path .= "/";
  47.  
  48.         $this->path = $path;
  49.     } // end func path
  50.  
  51.     /**
  52.     * Sets the template directory.
  53.     *
  54.     * @param    string
  55.     */
  56.     function setTemplateRoot($templateRoot) {
  57.  
  58.         if (!empty($templateRoot) && '/' != substr($templateRoot, -1))
  59.             $templateRoot .= "/";
  60.  
  61.         $this->templateRoot = $templateRoot;
  62.     } // end func setTemplateRoot
  63.  
  64.     /**
  65.     * Encodes the given string.
  66.     * 
  67.     * This function gets used to encode all userdependend 
  68.     * elements of the phpdoc xml files. Use it to 
  69.     * customize your rendering result: beware newlines (nl2br()),
  70.     * strip tags etc.
  71.     *
  72.     * @param    string  String to encode
  73.     * @return   string  $string    Encoded string
  74.     */
  75.     function encode($string) {
  76.         return nl2br(htmlspecialchars($string));
  77.     } // end func encode
  78.  
  79. } // end class PhpdocHTMLRenderer
  80. ?>
  81.